package com.hs.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.entity.ChargingStandards;
import com.hs.mapper.ChargingStandardsMapper;
import com.hs.service.ChargingStandardsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChargingStandardsServiceImpl implements ChargingStandardsService {
    @Autowired
    private ChargingStandardsMapper chargingStandardsMapper;
    @Override
    public int addChargingStandards(ChargingStandards chargingStandards) {
        return chargingStandardsMapper.addChargingStandards(chargingStandards);
    }

    @Override
    public int deleteChargingStandards(int id) {
        return chargingStandardsMapper.deleteChargingStandards(id);
    }

    @Override
    public int updateChargingStandards(ChargingStandards chargingStandards) {
        return chargingStandardsMapper.updateChargingStandards(chargingStandards);
    }

    @Override
    public ChargingStandards getChargingStandardsById(int id) {
        ChargingStandards chargingStandardsById = chargingStandardsMapper.getChargingStandardsById(id);
        return chargingStandardsById;
    }

    @Override
    public PageInfo<ChargingStandards> getChargingStandardsByPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<ChargingStandards> chargingStandardsByPage = chargingStandardsMapper.getChargingStandardsByPage();
        PageInfo<ChargingStandards> pageInfo = new PageInfo<>(chargingStandardsByPage);
        return pageInfo;
    }

    @Override
    public PageInfo<ChargingStandards> getChargingStandardsByConsultantId(int consultantId,int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ChargingStandards> chargingStandardsByConsultantId = chargingStandardsMapper.getChargingStandardsByConsultantId(consultantId);
        PageInfo<ChargingStandards> pageInfo = new PageInfo<>(chargingStandardsByConsultantId);
        return pageInfo;
    }
}
